const AutoTrader = require('../classes/AutoTrader')

let isMock = false,
  levarage = 50,
  buildRatio = 0.1

if (isMock) {
  ;(levarage = 1), (buildRatio = 0.5)
}

const trader = new AutoTrader({
  exchangeId: 'binance',
  apiKey: '0HXJp9xoYq3OeVKwmu5f6tbzp7kLVoRxNzoDgiddKHReUpt1TN1RmlPLB1xkZsYG',
  secret: 'DETPaJmbJE5kqCXhJ3a2slHMTMjGgyf9DtbLrhDmKUKYL8YZ2Uw3bIE6nB52eabd',
  tick: 'BTC/USDT',
  transactionType: 'future',
  rsiUpper: 75,
  rsiLower: 25,
  stochRsiUpper: 95,
  stochRsiLower: 5,
  minBollWidthRatio: 0.0045,
  loopDuration: 6000,
  isMock,
  levarage,
  buildRatio
})

trader.start()

process.on('uncaughtException', e => {
  console.log(e)
  process.exit(1)
})

process.on('unhandledRejection', function (err) {
  console.log(err)
  process.exit(1)
  //监听Promise没有被捕获的失败函数
})
